<template>
  <div class="cls1">
    <h2>这是用户详情页 - User</h2>
    <div>User {{ $route.params.username }} {{ $route.params.id }}</div>
<!-- http://127.0.0.1:5173/#/user/jack/posts/3?&a=10&b=20#c#4343-->
    <div>query= {{ $route.query }}</div>
    <div>hash= {{ $route.hash }}</div>
  </div>
</template>

<script setup>
import {useRoute} from 'vue-router'

const route = useRoute()
console.log("name:" + route.query.name)//接收参数
</script>

<style scoped>
.cls1 {
  background: #dff;
  min-height: 500px;
}

.cls1 h2 {
  margin: 0;
  padding: 0;
}
</style>